﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace verk2013_project_group12.Models
{
    public class GameInviteRepository
    {
        AppDataContext db = new AppDataContext();

        public IEnumerable<GameInvite> GetAllInvites()
        {
            return db.GameInvites;
        }

        public void Save()
        {
            db.SaveChanges();
        }

        public void Add(GameInvite invite)
        {
            db.GameInvites.Add(invite);
        }

        public GameInvite GetInviteByID(int id)
        {
            var theInvite = (from i in db.GameInvites
                             where i.ID == id
                             select i).SingleOrDefault();
            return theInvite;
        }

        public void Remove(GameInvite invite)
        {

            db.GameInvites.Remove(invite);
        }

    }

}